package com.moss.cloud.base.biz.controller;

import com.moss.cloud.base.api.model.from.BaseFrom;
import com.moss.cloud.base.api.model.param.FlowTaskParam;
import com.moss.cloud.base.biz.service.IFlowTaskService;
import com.moss.cloud.common.core.constant.ServiceList;
import com.moss.cloud.common.core.model.Result;
import com.moss.cloud.common.security.annotation.SysLog;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 流程任务前端控制器
 *
 * @author 瑾年
 * &#064;date  2024-03-06
 */
@RestController
@RequestMapping(ServiceList.BASE + "/flowTask")
public class FlowTaskController {
    private final IFlowTaskService flowTaskService;
    public FlowTaskController(IFlowTaskService flowTaskService) {
        this.flowTaskService = flowTaskService;
    }

    /**
     * 分页查询
     *
     * @param param
     * @return
     */
    @SysLog(serverName = ServiceList.MOSS_CLOUD_BASE, operation = "分页查询代办任务")
    @PostMapping("/page")
    public Result<?> page(@RequestBody @Validated FlowTaskParam param){
        return Result.success(flowTaskService.page(param));
    }

    /**
     * 任务详情
     *
     * @param baseFrom
     * @return
     */
    @SysLog(serverName = ServiceList.MOSS_CLOUD_BASE, operation = "代办任务详情")
    @PostMapping("/detail")
    public Result<?> detail(@RequestBody @Validated BaseFrom baseFrom){
        return Result.success(flowTaskService.detail(baseFrom));
    }


}
